﻿using iS3.DAL.Attributes;
using iS3.DAL.Table;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace iS3.DAL
{
    public class DGEntity:DGBase
    {
        [   
            PropertyName(chsName: "所属数据集"),
            PropertyDisplay(isCanIgnore: true,isCanOrder:false),
            PropertyExternal(Target ="sys")
        ]
        public virtual string SYS_DataSet { get; set; }
        [
    PropertyName(chsName: "数据状态"),
    PropertyDisplay(isCanIgnore: true, isCanOrder: false),
    PropertyExternal(Target = "sys")
]
        public virtual bool SYS_DataState { get; set; } = true;
        [
    PropertyName(chsName: "入库时间"),
    PropertyDisplay(isCanIgnore: true, isCanOrder: false),
    PropertyExternal(Target = "sys")
]
        public virtual DateTime SYS_DataTime { get; set; }
        [
    PropertyName(chsName: "数据附件"),
    PropertyDisplay(isCanIgnore: true, isCanOrder: false),
    PropertyExternal(Target = "sys.file")
]
        public virtual string SYS_DataFile { get; set; }



        public virtual List<DGEntityStruct> GetCapacity()
        {
            try
            {
                Type typeInfo = this.GetType();
                object[] entityTypeAtts = iS3ReflectTool.GetAttributes(typeInfo, typeof(DGEntityTypeAttribute));
                string _domain = (entityTypeAtts[0] as DGEntityTypeAttribute).Domain;
                string _type = typeInfo.Name;
                string _name = (entityTypeAtts[0] as DGEntityTypeAttribute).DGName;
                return new List<DGEntityStruct>() { new DGEntityStruct(_type) { EntityTypeName = _name, EntityDomain = _domain } };
            }
            catch (Exception ex)
            {
                return new List<DGEntityStruct>() {  };
            }
   
        }

    }


}
